<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/sks/cms/page/share/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<% String path = request.getContextPath(); 
   String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>修改密码: sks</title>

<link rel="stylesheet" type="text/css" media="screen" href="<%=basePath %>sks/css/frontpages/mytestcss.css" />
<SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
<script type="text/javascript" src="/js/jquery-1.3.1.min.js"></script>
<SCRIPT LANGUAGE="JavaScript">

function validateForm(){
	var password = $('#loginPwd').val();
	var confirm_password = $('#confirmPwd').val();
	
	var divMessage = $('#messagePwd');
	if(!password || $.trim(password)==""){
		divMessage.text("新密码不能为空");
		$('#loginPwd').focus();
		return false;
	}
	if(password.length<6 || password.length>20){
		divMessage.text("密码合法长度为6-20位字符");
		$('#loginPwd').focus();
		return false;
	}
	if(password!=confirm_password){
		divMessage.text("两次输入的密码不一致，请重新输入");
		$('#loginPwd').focus();
		return false;
	}
	return true;
}

function clearWarnMessage(){
	$('#messagePwd').text("");
	$('#messageConfirmPwd').text("");
}

$(document).ready(function(){
	$('#btnSubmit').click( function(){
		var form = $('#pwdForm');
		var params = form.serialize();
		var url= "/sks/privilege/users/changePwd.do?method=changepassword";
		var callback = function(data){
			if(data.result == "success"){
						if(confirm("修改改密码成功！\r\n为了您的账号安全，需要立即重新登录吗？")){
							location.href = data.redirUrl;
						}else{
							location.href = "sks/frontpages/privilege/deployment/list.do";
						}
					}else if(data.result == "failed"){
						alert("保存失败，请重新保存！");
					}
				}
		if(validateForm()){
			$.ajax({
				url:url,
				data:params,
				timeout:20000,
				method:'post',
				dataType:'json',
				success:callback,
				error:function(){ alert("请求失败！")}
			});
			
		}
		return false;
	});
	
});

</SCRIPT>
<style type="text/css">
 
.STYLE1 {color: #666666}
.logintitle H2 {
	DISPLAY: block; FONT-WEIGHT: bold; FONT-SIZE: 14px; MARGIN: 0px 0px 0px 0px;PADDING:0 0 0 10px;color:#525252
}
.ablue2{
	FONT-SIZE: 14px; color:#0066FF
}
 
</style>

</head>

<body>

<!-- Head End -->

<div class="wrap"><jsp:include page="../../header.jsp" /><%--头部--%>
<div>
<div><a href="<%=basePath%>" hidefocus="true">SKS房地产</a>&nbsp;&gt;&nbsp;
<a href="<%=basePath%>sks/frontpages/privilege/deployment/list.do"
	target="_self" hidefocus="true">个人中心</a> &gt; 修改密码</div>
<div class="clear"></div>
</div>
<div class="w main" style="height: 450px;">
<form id="pwdForm" method="post">
<table width="760px" border="0" cellpadding="0" cellspacing="0"
	align="center">
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" align="left" cellpadding="10"
			cellspacing="0">
			<tr>
				<td>
				<table width="100%" border="0" align="right" cellpadding="0"
					cellspacing="0">
					<tr>
						<td width="250px"align="right" class="c5"><strong>您的新密码是&nbsp;&nbsp; </strong></td>
						<td width="200px"><input type="password" name="loginPwd" id="loginPwd" maxlength="20"
							size="24" onkeyup="clearWarnMessage();" />
						</td>
						<td>
							<div id="messagePwd"
								style="font-size: 12px; margin: 5px 10px 5px 0; float: left; color: red"></div>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="right" height="15"></td>
					</tr>
					<tr>
						<td align="right" class="c5"><strong>重新输入一遍 &nbsp;&nbsp;</strong></td>
						<td><input type="password" name="confirm_password" id="confirmPwd"
							maxlength="20" size="24" onkeyup="clearWarnMessage();" /></td>
						<td>
						<div id="messageConfirmPwd"
							style="font-size: 13px; margin: 5px 10px 5px 0; float: left; color: red" />
						</td>
					</tr>
					<tr>
						<td colspan="3" align="right" height="15"></td>
					</tr>
					<tr>
						<td></td>
						<td>
						<button id="btnSubmit" alt="保存" >保存</button>
						</td>
						<td></td>

					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
</form>
</div>

<jsp:include page="../../rooster.jsp" /><%--尾部--%></div>
</body>
</html>





